import 'package:flutter/material.dart';

void main(List<String> args) {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.blueGrey),
      ),
      home: Scaffold(
        appBar: AppBar(title: Text('Flutter APP')),
        body: LayoutDemo(),
      ),
    );
  }
}

class LayoutDemo extends StatelessWidget {
  const LayoutDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return ListView(
      children: [
        Row(
          mainAxisAlignment: MainAxisAlignment.spaceAround,
          children: [
            ElevatedButton(
              onPressed: () {
                print('普通按钮');
              },
              child: Text('普通按钮'),
            ),
            TextButton(
              onPressed: () {
                print('文本按钮');
              },
              child: Text('文本按钮'),
            ),
            OutlinedButton(
              onPressed: () {
                print('边框按钮');
              },
              child: Text('边框按钮'),
            ),
            IconButton(
              onPressed: () {
                print('图标按钮');
              },
              icon: Icon(Icons.temple_buddhist_outlined),
            ),
          ],
        ),
        SizedBox(height: 20),
        Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            ElevatedButton.icon(
              onPressed: () {
                print('普通按钮 - 发送');
              },
              icon: const Icon(Icons.send),
              label: const Text('发送'),
            ),
            TextButton.icon(
              onPressed: () {
                print('文本按钮-消息');
              },
              icon: Icon(Icons.message),
              label: const Text('消息'),
            ),
            OutlinedButton.icon(
              onPressed: () {
                print('边框按钮 - 增加');
              },
              icon: Icon(Icons.add),
              label: const Text('增加'),
            ),
          ],
        ),
        SizedBox(height: 20),
        Row(
          mainAxisAlignment: MainAxisAlignment.spaceAround,
          children: [
            ElevatedButton.icon(
              onPressed: () {
                print('普通按钮 - 发送');
              },
              icon: const Icon(Icons.send),
              label: const Text('发送'),
              style: ButtonStyle(
                backgroundColor: WidgetStateProperty.all(Colors.red),
                foregroundColor: WidgetStateProperty.all(Colors.white),
              ),
            ),
          ],
        ),
        SizedBox(height: 20),
        Row(
          mainAxisAlignment: MainAxisAlignment.spaceAround,
          children: [
            Container(
              width: 200,
              height: 60,
              child: ElevatedButton(onPressed: () {}, child: const Text('大按钮')),
            ),
          ],
        ),
        SizedBox(height: 20),
        Row(
          mainAxisAlignment: MainAxisAlignment.spaceAround,
          children: [
            Expanded(
              child: Container(
                color: Colors.amber,
                height: 20,
                margin: EdgeInsets.all(10),
                child: ElevatedButton(
                  onPressed: () {},
                  child: const Text('自适应按钮'),
                ),
              ),
            ),
          ],
        ),
      ],
    );
  }
}
